<?php
namespace app\admin\validate;

use think\Validate;

/**
 * Class RoomTimeValidate
 * @package app\admin\validate
 */
class RoomTimeValidate extends Validate
{
    protected $rule = [
        'end_time' => 'require|date',
        'week' => 'unique:edu_class_room_time,week^id|require|chs',
        'start_time' => 'unique:edu_class_room_time,start_time^id|require|date',
    ];

    protected $message = [
        'week.unique' => '上课时间冲突',
        'start_time.unique' => '上课时间冲突',
        'week.chs' => '星期格式错误',
        'week.require' => '星期不能为空',
        'start_time.require' => '开始时间不能为空',
        'end_time.require' => '结束时间不能为空',
        'start_time.date' => '时间格式不对哦',
        'end_time.date' => '时间格式不对哦',
    ];

    protected $scene = [
        'room_edit' => ['week','start_time','end_time'],
    ];
}